# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-msoffcrypto-tool
pkgname=('python2-msoffcrypto-tool' 'python-msoffcrypto-tool')
_pkgname=msoffcrypto-tool
pkgver=5.4.2
pkgrel=1
epoch=1
pkgdesc='A Python tool and library for decrypting MS Office files with passwords or other keys.'
arch=('any')
url='https://pypi.org/project/msoffcrypto-tool/#files'
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('f498f980db2f06171a63dc4e79e827f767c397eaa837d4fda869b5c5867c311bd768576a64e02e829e724c9490319d9025e934447e2ab11a3774640ec3d979e8')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-msoffcrypto-tool() {
  depends=('python2' 'python2-olefile' 'python2-cryptography')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" -O1 --skip-build

  mv "$pkgdir/usr/bin/$_pkgname" "$pkgdir/usr/bin/${_pkgname}-2"
}

package_python-msoffcrypto-tool() {
  depends=('python' 'python-olefile' 'python-cryptography')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" -O1 --skip-build
}

